package com.flyme.module.base.client.api;


import com.flyme.common.core.model.ResultBody;
import com.flyme.common.core.model.query.PagerInfo;
import com.flyme.common.core.model.query.PqGrid;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author zyf
 */
public interface SysActionRemoteService {
    /**
     * 获取操作资源列表
     */
    @PostMapping("/action")
    PqGrid list(@RequestParam(value="pagerInfo", required=false) PagerInfo pagerInfo, @RequestParam(name="keyword", required=false) String keyword);


    /**
     * 获取操作资源
     * @param actionId actionId
     */
    @GetMapping("/action/{actionId}")
    ResultBody getAction(@PathVariable("actionId") Long actionId);

    /**
     * 获取操作资源
     * @param keyword keyword
     */
    @PostMapping("/action/list")
    PqGrid actionList(@RequestParam(value="pagerInfo") PagerInfo pagerInfo,@RequestParam(name="keyword", required=false) String keyword,@RequestParam(name="menuId", required=false) Long menuId);


    /**
     * 添加操作资源
     * @param actionCode 操作编码
     * @param actionName 操作名称
     * @param menuId 归属菜单
     * @param path 请求路径
     * @param status 是否启用
     * @param priority 优先级越小越靠前
     * @param actionDesc 描述
     */
    @PostMapping("/action/add")
    ResultBody addAction(@RequestParam(value="actionCode") String actionCode,@RequestParam(value="actionName") String actionName,@RequestParam(value="menuId") Long menuId,@RequestParam(value="path", required=false, defaultValue="") String path,@RequestParam(value="status", defaultValue="1") Integer status,@RequestParam(value="priority", required=false, defaultValue="0") Integer priority,@RequestParam(value="actionDesc", required=false, defaultValue="") String actionDesc);

    /**
     * 编辑操作资源
     * @param actionId 操作ID
     * @param actionCode 操作编码
     * @param actionName 操作名称
     * @param menuId 归属菜单
     * @param path 请求路径
     * @param status 是否启用
     * @param priority 优先级越小越靠前
     * @param actionDesc 描述
     */
    @PostMapping("/action/update")
    ResultBody updateAction(@RequestParam("actionId") Long actionId,@RequestParam(value="actionCode") String actionCode,@RequestParam(value="actionName") String actionName,@RequestParam(value="menuId") Long menuId,@RequestParam(value="path", required=false, defaultValue="") String path,@RequestParam(value="status", defaultValue="1") Integer status,@RequestParam(value="priority", required=false, defaultValue="0") Integer priority,@RequestParam(value="actionDesc", required=false, defaultValue="") String actionDesc);

    /**
     * 更新状态
     * @param actionId 操作ID
     * @param status 状态
     */
    @PostMapping("/action/update/status")
    ResultBody updateStatus(@RequestParam("actionId") Long actionId,@RequestParam(value="status", defaultValue="1") Integer status);

    /**
     * 移除操作
     * @param actionId 操作ID
     */
    @PostMapping("/action/remove")
    ResultBody removeAction(@RequestParam("actionId") Long actionId);
}
